Table of Contents [Hide/Show]
Overview Calling Jetfire Directly using .net DLR DLR Example Calling Jetfire Directly using Classes Set Method Get Method Execute Method New Method Access Modifiers Jetfire Exceptions API Examples
namespace DlrExample { public workflow MyFlow { public string MyString{get; set;} public string MyAction(){ return this.MyString;} public string MyAction(string s){return s;} } }
dynamic myFlow = nexus.New<Workflow>("DlrExample.MyFlow"); // // Access the Workflow's properties and methods // myFlow.MyString = "some string"; Assert.AreEqual("some string", (string)myFlow.MyString); Assert.AreEqual("some string", (string)myFlow.MyAction()); Assert.AreEqual("some other string", (string)myFlow.MyAction("some other string"));
// Get the value from the property named "Hello". string creationTime = workflow.Get<string>("Hello");
// Get the roles of the logged in user. TjRole[] roles = nexus.UserLogin.DefaultProfile.Get<TjRole[]>("roles");
// Get the values of the properties specified. TjItemResult[] items = machine.Get( new string[] { "MachineName", "InstalledDate", "Location", "Condition", "Weight" });
// Execute the 'Borrow' method on the workflow 'dvd'. dvd.Execute("Borrow");
// Find a workflow class called "HelloWorld" in a namespace called "test". TjWorkflowClass workflowClass = nexus.FindClass<TjWorkflowClass>("test", "HelloWorld"); TjWorkflow workflow = workflowClass.New();
//creates a new object of the type "Role" where the name is "Manager". TjRole roleManager = nexus.RoleClass.New<TjRole>("Manager");
if(dvd.DynamicAccessModifier("Borrow") == TjAccessModifierType.Private) { // take action to 'grey' out 'Borrow' command }
// Jetfire property public int Number { set { if(value < 0 || value > 10) throw exception("Houston, there is a problem!"); this.number = value; } }
try { flow.Set("Number", 11); } catch (JetfireException ex) { // take some action }